﻿using System;
using UnityEngine;

namespace RootMotion
{
	// Token: 0x020000DA RID: 218
	public class CameraControllerFPS : MonoBehaviour
	{
		// Token: 0x06000657 RID: 1623 RVA: 0x000399C0 File Offset: 0x00037BC0
		public void Awake()
		{
			Vector3 eulerAngles = base.transform.eulerAngles;
			this.x = eulerAngles.y;
			this.y = eulerAngles.x;
		}

		// Token: 0x06000658 RID: 1624 RVA: 0x000399F4 File Offset: 0x00037BF4
		public void LateUpdate()
		{
			Cursor.lockState = CursorLockMode.Locked;
			this.x += Input.GetAxis("Mouse X") * this.rotationSensitivity;
			this.y = this.ClampAngle(this.y - Input.GetAxis("Mouse Y") * this.rotationSensitivity, this.yMinLimit, this.yMaxLimit);
			base.transform.rotation = Quaternion.AngleAxis(this.x, Vector3.up) * Quaternion.AngleAxis(this.y, Vector3.right);
		}

		// Token: 0x06000659 RID: 1625 RVA: 0x00005EC8 File Offset: 0x000040C8
		public float ClampAngle(float angle, float min, float max)
		{
			if (angle < -360f)
			{
				angle += 360f;
			}
			if (angle > 360f)
			{
				angle -= 360f;
			}
			return Mathf.Clamp(angle, min, max);
		}

		// Token: 0x0400059C RID: 1436
		public float rotationSensitivity = 3f;

		// Token: 0x0400059D RID: 1437
		public float yMinLimit = -89f;

		// Token: 0x0400059E RID: 1438
		public float yMaxLimit = 89f;

		// Token: 0x0400059F RID: 1439
		public float x;

		// Token: 0x040005A0 RID: 1440
		public float y;
	}
}
